**Parenting items
cd "${base}"
use "${base}\replication_file\Gallup_Family_Adolescent_Health_2023_Replication_File.dta", clear

global neg_loadf1 "B10_14	B10_17	B10_15	B10_13"

**REVERSE CODE negative loaders**
foreach  i in $neg_loadf1 {
gen RE`i'=5 if `i'==1
replace RE`i'=4 if `i'==2
replace RE`i'=3 if `i'==3
replace RE`i'=2 if `i'==4
replace RE`i'=1 if `i'==5
}

global parenting_items "B10_16	B10_21	B10_2	B10_6	B10_12	B10_19	B10_18	B10_4	B11C	B10_1	B10_3 B10_15	B10_13	B10_5	B10_17	B10_14"
global relate_items "NC20_alcohol	NC21_angry	NC23_left	NC23a_rejection	C24_safety	REB11A	B11B	C19_parent_love	B6_overall_parent_ch B9_relationship_othe REB10_8"							

egen rules=rowmean(B10_2	B10_6	B10_3	B10_1	B10_5	B10_19	B10_4	B10_21	B10_7)
egen enforce=rowmean(REB10_14	REB10_17 REB10_15	REB10_13	B10_16	B10_18)
egen relate=rowmean(B6_overall_parent_ch B11B	REB11A	REB10_8	C19_parent_love	B9_relationship_othe)
egen adverse=rowmean(C24_safety	NC21_angry	NC23a_rejection	NC23_left	NC20_alcohol)

foreach x in  $parenting_items $relate_items {
sum `x' [aw=weight]
gen AVG`x'=r(mean)
gen SD`x'=r(sd) 
gen OBS`x'=r(N) 
}

keep in 1
keep AVGB10_16- OBSREB10_8
gen n=1
reshape long  AVG SD OBS, i(n) j(var) string

export delimited "${output}\Mean_Std_Dev_of_Parenting_Items.csv", replace

**Parent-reported demos--weighted
use "${base}\replication_file\Gallup_Family_Adolescent_Health_2023_Replication_File.dta", clear

sum hhinc [aw=weight], detail
tab RACE 
tab RACE [aw=weight]

foreach x in  parent_age dad married sole_caretaker bio_parent hhinc inc_bel60 inc_abv175 parent_hs_less parent_some parent_ba parent_grad asian black hispanic multi white {
sum `x' [aw=weight]
gen AVG`x'=r(mean)
gen MIN`x'=r(min)
gen MAX`x'=r(max)
gen SD`x'=r(sd) 
gen OBS`x'=r(N) 
}


keep in 1
keep AVGparent_age- OBSwhite
gen n=1
reshape long  AVG MIN MAX SD OBS, i(n) j(var) string

export delimited "${output}\Mean_Std_Dev_of_Parent_Demographic_Items.csv", replace

**Parent-reported demos--weighted
use "${base}\replication_file\Gallup_Family_Adolescent_Health_2023_Replication_File.dta", clear

foreach x in  parent_age dad married sole_caretaker bio_parent hhinc inc_bel60 inc_abv175 parent_hs_less parent_some parent_ba parent_grad asian black hispanic multi white {
sum `x' 
gen AVG`x'=r(mean)
gen MIN`x'=r(min)
gen MAX`x'=r(max)
gen SD`x'=r(sd) 
gen OBS`x'=r(N) 
}

keep in 1
keep AVGparent_age- OBSwhite
gen n=1
reshape long  AVG MIN MAX SD OBS, i(n) j(var) string

export delimited "${output}\Unweighted_Mean_Std_Dev_of_Parent_Demographic_Items.csv", replace

**Teen-reported demos
use "${base}\replication_file\Gallup_Family_Adolescent_Health_2023_Replication_File.dta", clear

sum child_weight
sum male C19 [aw=child_weight]

foreach x in  age age_group_num3 age_group_num4 age_group_num5 age_group_num6 age_group_num7 age_group_num8 age_group_num9  male {
sum `x' [aw=child_weight]
gen AVG`x'=r(mean)
gen MIN`x'=r(min)
gen MAX`x'=r(max)
gen SD`x'=r(sd) 
gen OBS`x'=r(N) 
}

keep in 1
keep AVGage- OBSmale
gen n=1
reshape long  AVG MIN MAX SD OBS, i(n) j(var) string

export delimited "${output}\Mean_Std_Dev_of_Adolescent_Demographic_Items.csv", replace


